package com.innovation.chengzhangriji.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import com.innovation.chengzhangriji.ui.HomeActivity;

import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;

public class HomePageAdapter extends FragmentPagerAdapter {

    public interface HomePageAdapterAgent {
        int getFragmentCount();
        ArrayList<Fragment> getFragments();
    }

    public HomePageAdapter(FragmentManager fm, HomePageAdapterAgent agent) {
        super(fm);
        this.agent = agent;
    }

    private HomePageAdapterAgent agent;

    @Override
    public Fragment getItem(int position) {
        return agent.getFragments().get(position);
    }

    @Override
    public int getCount() {
        return agent.getFragmentCount();
    }
}
